<?php
/**
 * Created by PhpStorm.
 * User: shiding
 * Date: 2019-06-24
 * Time: 17:03
 */

namespace App\Http\Repositories;

use App\Models\AboutMe;

class AboutMeRepository
{
    protected $aboutMeModel;

    public function __construct(AboutMe $aboutMe)
    {
        $this->aboutMeModel = $aboutMe;
    }

    public function getInfo()
    {
        return $this->aboutMeModel->first();
    }

    public function edit($params)
    {
        $check = $this->aboutMeModel->first();
        return $check
            ? $this->aboutMeModel->where('id', $check->id)->update($params)
            : $this->aboutMeModel->insert($params);
    }

}